#include<stdio.h>
#include<sys/types.h>
#include<unistd.h>
#include<errno.h>
#include<string.h>
#include<stdlib.h>
#include<sys/wait.h>
char* const addenv[]={
    (char* const)"myval=9999",
    NULL 
};
char* newenv=(char*)"value=666666";
int main()
{
    printf("我要执行程序了\n");
    pid_t id=fork();
    if(id==0)
    {       
        printf("I am child,my pid is :%d\n",getpid());
        sleep(1);
        char* const argv[]={
            (char* const)"other",
            (char* const)"-a",
            (char* const)"-b",
            (char* const)"-c",
            (char* const)"-d",
            NULL
        }; 
        char* const env[]={
           (char* const)"myval=123456",
               NULL
        };
        int i=0;
        for(;addenv[i];i++)
        {
            putenv(addenv[i]);
        }
       // putenv(newenv);
        extern char **environ; 
        execvp("./other",argv);
        exit(0);
    }
    waitpid(id,NULL,0);
    printf("我的程序执行完毕了\n");

    return 0;
}
